package com.dgut.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.dgut.common.model.entity.Contract;
import com.dgut.common.util.SystemJsonResponse;
import com.dgut.service.ContractsService;

/**
 * @author huangyujia <huangyujia@kuaishou.com>
 * Created on 2024-06-18
 */
@RestController
@RequestMapping("contract")
public class ContractController {

    @Autowired
    private ContractsService contractsService;

    @PostMapping("/create")
    public SystemJsonResponse createContract(@RequestParam Map<String, Integer> goodsMap) {
        return contractsService.createContract(goodsMap);
    }

    @PostMapping("finish")
    public SystemJsonResponse finishContract(@RequestBody Contract contract) {
        return contractsService.finishContract(contract);
    }
}
